<?php
defined('IN_ADMIN') or exit('No permission resources.'); 
include $this->admin_tpl('header', 'admin');
?>

<div class="pad-10">
<form action="?m=wap&c=wap_admin&a=edit_template" method="post" id="myform">
 <div class="bk10"></div>
 <fieldset>
	<legend><?php echo L('parameter_config')?></legend>  
	<table width="100%"  class="table_form">
		<input type="hidden" name="type" value="<?php echo $template_info['type']?>">
	<?php if ($template_info['type'] == 0) {?>
    <tr>
    <th width="120">频道页模板名称</th>
    <input type="hidden" name="typeid" value="<?php echo $typeid; ?>">
    <td class="y-bg">
        <div id="category_template"></div>
    </td>
    </tr>
    <tr>
    <th width="120">栏目页模板名称</th>
    <input type="hidden" name="typeid" value="<?php echo $typeid; ?>">
    <td class="y-bg"><div id="list_template"></div></td>
    </tr>  
    <tr>
    <th width="120">内容页模板名称</th>
    <input type="hidden" name="typeid" value="<?php echo $typeid; ?>">
    <td class="y-bg"><div id="show_template"></div></td>
    </tr> 
    <?php 	}elseif ($template_info['type']==1) { ?>
	<tr>
    <th width="120">单页模板名称</th>
    <input type="hidden" name="typeid" value="<?php echo $typeid; ?>">
    <td class="y-bg"><div id="page_template"></div></td>
    </tr> 
    <?php }elseif ($template_info['type']==2) { ?>
	<tr>
    <th width="120">外链网址&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://</th>
    <input type="hidden" name="typeid" value="<?php echo $typeid; ?>">
    <td class="y-bg"><input type="text" class="input-text" name="template[url]" size="20" value="<?php echo $template_info['template']['url']; ?>"/></td>
    </tr> 
    <?php }?>                      
</table>

<div class="bk15"></div>
<input type="submit" id="dosubmit" name="dosubmit" class="dialog" value="<?php echo L('submit')?>" />
</fieldset>
</form>
</div>
</body>
</html>
<script>
    function load_file_list(id) {
        if(id=='') return false;
		
        $.getJSON('?m=wap&c=wap_admin&a=public_tpl_file_list&style='+id+'&typeid=<?php echo $typeid?>', function(data){
            console.log(data)
            $('#category_template').html(data.category_template);
            $('#list_template').html(data.list_template);
            $('#show_template').html(data.show_template);
			$('#page_template').html(data.page_template);
		});
    }
    <?php
        echo "load_file_list('".$default_style."')";
    ?>
</script>